package main

import (
	"github.com/labstack/echo/v4"
	"github.com/micro/go-micro/v2/web"
)

// http://localhost:9990/hello

func main() { //20200727

	service := web.NewService(
		web.Name("echo.hello"),
		web.Address(":9990"))

	service.Handle("/", echoHandle()) //使用echo 来处理api
	service.Init()
	service.Run()
}

func echoHandle() *echo.Echo {
	e := echo.New()
	e.GET("/hello", hello)
	return e
}

func hello(context echo.Context) error {
	return context.JSON(200, "hi")
}
